package com.leo.collisions;

import com.almasb.fxgl.entity.Entity;
import com.almasb.fxgl.physics.CollisionHandler;
import com.leo.common.GameType;

/**
 * 子弹和子弹的碰撞检测
 */
public class BulletBulletHandler extends CollisionHandler {

    public BulletBulletHandler() {
        super(GameType.BULLET, GameType.BULLET);
    }

    @Override
    protected void onCollisionBegin(Entity a, Entity b) {
        GameType ownerTypeA = a.getObject("ownerType");
        GameType ownerTypeB = b.getObject("ownerType");
        if (ownerTypeA != ownerTypeB) {
            a.removeFromWorld();
            b.removeFromWorld();
        }
    }
}
